/**
 * Created by yao on 2014/10/7.
 */
// 个人信息
var M_personal = Backbone.Model.extend({

    url : URL.personal,

    initialize : function(){
        this.bind('error', function(model, error){
            console.log(error);
        });
    },

    fetchData : function(callbackObj){
        this.fetch(callbackObj);
    },

    default : {
        std_name : "",
        std_department : "",
        std_teacher : "",
        std_id : "",
        std_phone : "",
        std_qq : "",
        std_email : "",
        std_job : ""
    }
});

// 任务数罗列
var M_workplacaMission = Backbone.Model.extend({

    url : URL.workplace_mission,

    initialize : function(){
        this.bind('error', function(model, error){
            console.log(error);
        });
    },

    default : {
        SuccessMission : "",
        RunningMission : ""
    }
});


// 公告
var M_broadcast = Backbone.Model.extend({

    urlRoot : URL.broadcast,

    initialize : function(){
        this.bind('error',function(){
            console.log('broadcast got error!');
        });
    },

    fetchData : function(callbackObj){
        this.fetch(callbackObj);
    },

    default : {
        "web" : [
            {
                id : "",
                type : "broadcast",
                department : "web研发部",
                content : "",
                time : "",
                person : "",
                title : ""
            }
        ],

        "mobile" : [
            {
                id : "",
                type : "broadcast",
                department : "web研发部",
                content : "",
                time : "",
                person : "",
                title : ""
            }
        ]

    }
});

// 提交列表
var M_puttask = Backbone.Model.extend({

    //url : 'test.php',
    url : URL.showtask,

    initialize : function(){
        this.bind('error', function(model, error){
            console.log(error);
        });
    },

    default : {
        id : "",
        title : "",
        time : ""
    }
});

// 任务列表
var M_mission = Backbone.Model.extend({

    url : URL.mission,

    initialize : function(){
        this.bind('error', function(model, error){
            console.log(error);
        });
    },

    fetchData : function(callbackObj){
        this.fetch(callbackObj);
    },

    default : {
        "id" : "",
        "type" : "mission",
        "total" : [
            {
                "state" : "",
                "title" : "",
                "publisher" : "", // 发布人,
                "summary" : "",
                "details" : "",
                "score" : "",
                "people" : [],
                "time" : { begin : "", end : ""},
                "accessory" : "", // 附件名
                "suggest" : ""

            }
        ],
        "finished" : [
            {
                "state" : "",
                "title" : "",
                "publisher" : "" ,// 发布人,
                "summary" : "",
                "details" : "",
                "score" : "",
                "people" : [],
                "time" : { begin : "", end : ""},
                "accessory" : "", // 附件名
                "suggest" : ""
            }
        ],
        "unfinished" : [
            {
                "state" : "",
                "title" : "",
                "publisher" : "", // 发布人,
                "summary" : "",
                "details" : "",
                "people" : [],
                "time" : { begin : "", end : ""},
                "accessory" : "" // 附件名
            }
        ],
        "expired" : [
            {
                "state" : "",
                "title" : "",
                "publisher" : "", // 发布人,
                "summary" : "",
                "details" : "",
                "people" : [],
                "time" : { begin : "", end : ""},
                "accessory" : "" // 附件名
            }
        ]
    }
});

var  M_publish = Backbone.Model.extend({
    url : URL.publish,
    initialize : function(){
        this.bind('error',function(){
            console.log("person information got error!");
        });
    },

    default :{
        people : ""
    }
});

var m_personal = new M_personal();
var m_mission = new M_mission();
var m_broadcast = new M_broadcast();

